<script type="text/javascript">

$(".prod-div a").draggable();
</script>

<div id="list-products">
<?php if(sizeof($this->product) > 0):?>
	<div id="list-order">
		<div class="left">
			<p align="center">
				<select id="order" name="order"
					onchange="getPaginatedListProducts('/products/search-products','list-products')">
					<option <?php if($this->orderBy == "pr.price-asc"):?>
						selected="selected" <?php endif;?> value="pr.price-asc">Preço
						crescente</option>
					<option <?php if($this->orderBy == "pr.price-desc"):?>
						selected="selected" <?php endif;?> value="pr.price-desc">Preço
						decrescente</option>
					<option <?php if($this->orderBy == "pr.date_insert-desc"):?>
						selected="selected" <?php endif;?> value="pr.date_insert-desc">Mais
						recentes</option>
				</select>
			</p>
		</div>
		<div class="left">
			<p align="center">
				<select id="itens" name="itens"
					onchange="getPaginatedListProducts('/products/search-products','list-products')">
					<option <?php if($this->itensPage == 12):?> selected="selected"
					<?php endif;?> value="12">12 itens por página</option>
					<option <?php if($this->itensPage == 24):?> selected="selected"
					<?php endif;?> value="24">24 itens por página</option>
					<option <?php if($this->itensPage == 32):?> selected="selected"
					<?php endif;?> value="32">32 itens por página</option>
				</select>
			</p>
		</div>
	</div>
	<input id="enterprise" name="enterprise" type="hidden"
		value="<?php echo $this->enterprise?>"> <input id="category"
		name="category" type="hidden" value="<?php echo $this->category?>"> <input
		id="filter" name="filter" type="hidden"
		value="<?php echo $this->search?>"> <input id="itensPage"
		name="itensPage" type="hidden" value="<?php echo $this->itensPage?>">
	<input id="orderBy" name="orderBy" type="hidden"
		value="<?php echo $this->orderBy?>">

	<div style="display: inline-block;" id="prod">
	<?php
	$i = 0;
	foreach ($this->product as $product):
	$i = $i+1;
	?>


		<div class="prod-div">
			<h2 title="<?php echo $product["name"]?>"
				style="background: url(../images/titulo-produto-bg.jpg) repeat-x; text-align: center; margin-bottom: 15px;">
				<?php if(strlen($product["name"]) < 20):?>
				<a style="cursor: pointer;"
					href="/products/view-product?product=<?php echo $product['id_product']?>"
					class="link"> <?php echo $product["name"]?> <br /> <?php echo utf8_encode($product["title"])?>

				</a>
				<?php else:?>
				<a style="cursor: pointer;"
					href="/products/view-product?product=<?php echo $product['id_product']?>"
					class="link"> <?php echo substr($product["name"], 0, 16).'...'?> <br />

					<?php echo utf8_encode($product["title"])?> </a>
					<?php endif;?>
			</h2>

			<div style="text-align: center;">
				<a
					href="/products/view-product?product=<?php echo $product['id_product']?>">
					<img src="<?php echo $product["image"]?>" width="135"
					height="135" alt="<?php echo $product["name"]?>"
					title="<?php echo $product["name"]?>" /> </a>
				<p style="height: 22px;">
				<?php if($product['status'] == 1 && $product['quantity'] > 0):?>
					<?php $price = explode('.', $product["price"]);?>
					<font style="margin-left: 10px;">R$ <?php echo $price[0].','?>
					</font><sup><?php echo $price[1]?></sup> <span class="clear">&nbsp</span>
					<?php else:?>
					<font style="font-size: 15px; margin-left: 15px;">Produto
						indisponível no momento</font>
						<?php endif;?>
				</p>
			</div>
			<div>
			<?php if($product['status'] == 1 && $product['quantity'] > 0):?>
				<div style="margin-top: 15px; text-align: center">
					<font style="font-size: 14px; float: left;">Avaliação do produto:</font>
					<div class="rating" style="float: left;"
						title="<?php if($this->rate[$product['id_product']] == 0){echo 'Nenhuma avaliação para o produto';}else{ echo "Nota do produto: "; if($this->rate[$product['id_product']] > 5){echo '5';}else{echo $this->rate[$product['id_product']];} }?>">
						<div class="star"
						<?php if($this->rate[$product['id_product']] >= 1):?>
							style="background-position: 0 -16px;" <?php endif;?>></div>
						<div class="star"
						<?php if($this->rate[$product['id_product']] >= 2):?>
							style="background-position: 0 -16px;" <?php endif;?>></div>
						<div class="star"
						<?php if($this->rate[$product['id_product']] >= 3):?>
							style="background-position: 0 -16px;" <?php endif;?>></div>
						<div class="star"
						<?php if($this->rate[$product['id_product']] >= 4):?>
							style="background-position: 0 -16px;" <?php endif;?>></div>
						<div class="star"
						<?php if($this->rate[$product['id_product']] >= 5):?>
							style="background-position: 0 -16px;" <?php endif;?>></div>
					</div>
				</div>
				<?php endif;?>
			</div>
		</div>

		<?php endforeach;?>
	</div>

	<div class="sub-prod">
		<div>
			<p align="center">
				<!-- PAGINAÇÃO -->
			<?php echo $this->paginationControl($this->product, 'Sliding', '/products/_pagination-solicitation.phtml'); ?>
				<!-- [END] PAGINAÇÃO -->
			</p>
		</div>
	</div>
	<?php else:?>
	<div class="nothing">Nenhum produto encontrado.</div>
	<?php endif;?>
</div>
